<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <link rel="stylesheet" href="mm_lodging1.css" type="text/css" />
    <title>GeoPuebla</title>
    
	<?php 
		include "Global.php";
		GetMap()
	?>

    <script type="text/javascript" src="pdmarker.js"></script>
    
    <script type="text/javascript">
	var map = null;
	
    function initialize() {
      if (GBrowserIsCompatible()) {
			
		<?php
	
		MapInitialization();
	
		$id= $_POST["tour"];
		
		//Conexion a mysql y a la base de datos
		$connection = DBConnect();
	
		//Selecciona todos los lugares de la base de datos
			$xant=NULL;
			$yant=NULL;
			$num=0;
		$query2="select * from places where IDplaces in (select IDplace from tour_places where IDtour=$id)"; 
		$resultado2 = mysql_query($query2) or die ('\n error en query ' . mysql_error());
		while($row = mysql_fetch_assoc($resultado2)){
			$num=$num+1;
			$id=$row['IDplaces'];
			$x=$row['CoordX'];
			$y=$row['CoordY'];
			$name=$row['Name'];
			$adress=$row['Adress'];
			$mi=$row['MoreInfo'];
			$image=$row['Image'];
			
			if($num==1){
				$x1=$x;
				$y1=$y;
			}
			
			//Codigo html para lo que sera desplegado en 
			$html="<h1>$name</h1>".
					"<img src=img/$image height=300 weight=300 align=center>".
					"<p><b>Adress:</b> $adress</p>".
					"<p>$mi</p>";
	
			//Llena el mapa con los marcadores correspondiendes 
				echo "marker = new PdMarker(new GLatLng($x, $y));";
				echo "marker.setTooltip('$name');";
				echo "marker.setHoverImage('http://www.google.com/mapfiles/dd-start.png');";
				echo "marker.setDetailWinHTML('$html');";
				echo "map.addOverlay(marker);";
					
			if($xant!=NULL && $yant!=NULL){	
				echo "var polyline = new GPolyline([new GLatLng($xant, $yant),new GLatLng($x, $y)], '#0099CC', 5, 0.7);";
				echo "map.addOverlay(polyline);";
			}
			
			$xant=$x;
			$yant=$y;		
		}
		echo "var polyline = new GPolyline([new GLatLng($x, $y),new GLatLng($x1, $y1)], '#0099CC', 5, 0.7);";
		echo "map.addOverlay(polyline);";
		DBCLose($connection);
		?>

      }
    }
	

    </script>
  </head>
  <body onload="initialize()" onunload="GUnload()">
    <div id="map_canvas" style="width: 950px; height: 525px" align=center></div>
  </body>
</html>
